package com.yang.core.config;

import com.yang.core.extension.RestClientExtension;
import com.yang.core.api.RestClientInterceptor;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.Duration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * RestClient配置类
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RestClientConfig {

    // 基础配置
    private String baseUrl;
    private String userAgent;
    private String charset;
    private boolean followRedirects;

    // 超时配置
    private Duration connectTimeout;
    private Duration socketTimeout;
    private Duration requestTimeout;
    private Duration connectionRequestTimeout;

    // 连接池配置
    private int maxConnectionsTotal;
    private int maxConnectionsPerRoute;
    private Duration connectionTTL;
    private Duration validateAfterInactivity;

    // 重试配置
    private boolean retryEnabled;
    private int maxRetries;
    private Duration retryDelay;
    private double retryBackoffMultiplier;
    private Duration maxRetryDelay;

    // 代理配置
    private String proxyHost;
    private int proxyPort;
    private String proxyUsername;
    private String proxyPassword;

    // SSL配置
    private boolean trustAllCertificates;
    private boolean hostnameVerification;

    // 压缩配置
    private boolean compressionEnabled;

    // 默认请求头
    private Map<String, String> defaultHeaders;

    // 拦截器
    private List<RestClientInterceptor> interceptors;

    // 扩展
    private List<RestClientExtension> extensions;

    // 自定义配置
    private Map<String, Object> customProperties;
}